<template>
	<view>
		<image :src="srcEmp" v-show="empty" class="emp-img-g"></image>
		<scroll-view v-show="!empty" scroll-y enhanced scroll-with-animation :scroll-top="-1" :show-scrollbar="false"
			:style="{height: scrollHeight + 'rpx' }">
			<view class="msglist-card" v-for="item in mylist" :key="item.projId"
				@click="emitId(item.projId)">
				<view class="icon-close" @click.stop="remove(item.projId)" >
					<u-icon name="close" color="#c0c0c0" size="14px"></u-icon>
				</view>
				<view class="title-box">
					<u-icon :name="iconName"></u-icon>
					<view class="title u-line-1">&nbsp {{item.projName||'--'}}</view>
				</view>
				<view class="line"></view>
				<view class="user-box2">
					<text class="poptxt">{{poptxt}}</text>
					<text style="margin: -8rpx 8rpx;color: #424242;">·</text>
					<at-formattime :timetamp="item.createTime || ''" class="time"></at-formattime>
				</view>
				<view class="tag-box" v-if="type === '1'">
					<u-tag :text="statusDesc(item.mark)" plain size="mini" :type="tagType(item.mark)"></u-tag>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import AtFormattime from '@/components/AtFormattime'
	export default {
		components: {
			AtFormattime
		},
		data(){
			return{
				scrollHeight : uni.$screenHeight - uni.$topFixedHeight,
				mylist : [],
				empty:false
			}
		},
		props:{
			list:Array,
			type:String,
			iempty:Boolean
		},
		watch: {
			iempty(n, o) {
				this.empty = n
				// console.log('this.empty=====',this.empty);
			},
			list(n,o){
				this.mylist = n
			},
		},
		
		computed:{
			iconName(){
				return this.type === "1" ? 'order' : 'star-fill'
			},
			poptxt(){
				return this.type === "1" ? '发布于' : '收藏于'
			},
			srcEmp(){
				return this.type === "1" ? '/static/imgs/noData.png' : '/static/imgs/noCollect.png'
			}
		},
		methods:{
			statusDesc(mark){
				return mark == '0' ? '审核中' : '已发布'
			},
			tagType(mark){
				return mark == '0' ? 'error' : 'success'
			},
			remove(id){
				this.$emit('remove',id)
			},
			emitId(id){
				this.$emit('toDet',id)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.msglist-card {
		margin: 15rpx auto;
		background-color: #fff;
		width: 92%;
		position: relative;
		border-radius: 10rpx;
		display: flex;
		flex-direction: column;
	
		.icon-close {
			position: absolute;
			right: 10rpx;
			top: 10rpx;
		}
	
		.title-box {
			width: 92%;
			margin: 20rpx auto;
			display: flex;
			font-weight: bold;
			font-size: 16px;
		}
	
		.line {
			width: 92%;
			margin: 0 auto;
			border-top: 1rpx solid #eee;
		}
	
		
	
		.user-box2 {
			width: 92%;
			margin: 25rpx auto;
			padding: 10rpx 0;
			display: flex;
	
			.poptxt {
				color: #424242;
				font-size: 10px;
			}
	
			.time {
				font-size: 10px;
				color: #424242;
			}
		}
	
		.tag-box {
			position: absolute;
			// bottom: 30rpx;
			top: 105rpx;
			// transform: translateY(-50%);
			right: 15rpx;
		}
	
	}
</style>